<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<jsp:include page="page.jsp"></jsp:include>
<div id="historyDiv" style="display:block;height:270px;width:100%;overflow-y:scroll;">
<s:iterator value="imList">　<s:property value="sender.userName"/>　<s:date name="sendDate" format="yyyy-MM-dd hh:mm:ss"/>　<br/>　　　<s:if test="sheetId!=null"><span onclick="<s:property value="sheetUrl"/>" style="color:#858585;cursor:pointer;"></s:if><s:property value="msgContent"/><s:if test="sheetId!=null"></span></s:if><br/></s:iterator>
</div>
<div id="searchHistoryDiv" style="padding-top: 5px;width:100%;display:block"></div>     
<div id="paginationIm" style="padding-top: 5px;width:100%"></div>
<input type="hidden" id="urlforwardIm" value="cts/getImContentHistory.action"/>
<div  id="popdiv_inner_query_im" class="im_popdiv_inner" style="z-index:6000;width: 960px;">
		<div class="im_popdiv_inner_outter"></div>
		<div class="im_popdiv_close" onclick="clearMyImDivContent('popdiv_content_query_im');myClosePopDiv('popdiv_inner_query_im','popdiv_outter_im')"></div>
		<div class="im_popdiv_handle" style="cursor: default" id="popdiv_handle" title="鼠标左键按住可拖动">详情</div>
	    <div class="im_popdiv_content" id="popdiv_content_query_im" style="float: left;width:938px;"></div>
	</div>

<script type="text/javascript">
	paginationCommonIm(0);
	showOrHideSearchHitory();
	
	function showQuery_im( idVal){
		var url = 'cts/getInnerSheetDetail.action?id='+idVal;
		  $.post(url , "" , function(data){
	         $("#popdiv_inner_query_im").find("div[id=popdiv_content_query_im]").html(data);
	         myImOpenPopDiv('popdiv_inner_query_im','popdiv_outter_im');
	      });
	}
	
	function myImOpenPopDiv(popdiv_inner , popdiv_outter) {
		var maskHeight = $(document).height();  
		var maskWidth = $(window).width();
		var dialogTop = (maskHeight/2 - $('#' + popdiv_inner).height());
	    var dialogLeft = (maskWidth/2) - ($('#' + popdiv_inner).width());  
		
		var timeM = new Date();
		var time = timeM.valueOf();
		
		
		$('#' + popdiv_outter).show().css({
		   "height" : maskHeight,
		   "width" : maskWidth,
		   "z-index": 4999
		});
		 
		$('#' + popdiv_inner).show().css({
		    "top" : 100, 
		    "left" : dialogLeft + 20,
		    "z-index":5001
		});
	}
	
	function myClosePopDiv(popdiv_inner , popdiv_outter){
		$('#' + popdiv_outter).hide();
		$('#' + popdiv_inner).hide();
	}
	
	function clearMyImDivContent(id){
		$("#"+id).html('');
	}
	
	function delImContentHistory(){
		if(confirm("您确定清空与TA的历史聊天记录吗？")){
			$.ajax({
				type:"POST",
				data:"uid="+$("#uid").val()+"&systemType="+$("#systemType").val(),
				url:"${pageContext.request.contextPath}/cts/delImContentHistory.action",
				cache:false,
				async:false,
				success:function (data){
					if(data==0){
						$("#historyDiv").html("");
						$("#searchContent").val("");
						getImContentHistory(1);
					}
				}
			});
		}
	}
</script>